﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MMK.Paket_Tracker.Runtime;

namespace MMK.Paket_Tracker.GUI.Models
{
    /// <summary>
    /// Model for the check data viewmodel
    /// </summary>
    public class CheckDataModel : ModelBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CheckDataModel"/> class.
        /// </summary>
        public CheckDataModel()
        {
            SendFirstName = BusinessLogic.BusinessLogic.SenderModel.FirstName;
            SendLastName = BusinessLogic.BusinessLogic.SenderModel.LastName;
            SendNumber = BusinessLogic.BusinessLogic.SenderModel.Number;
            SendPostCode = BusinessLogic.BusinessLogic.SenderModel.PostCode;
            SendStreet = BusinessLogic.BusinessLogic.SenderModel.Street;
            SendTown = BusinessLogic.BusinessLogic.SenderModel.Town;

            FirstName = BusinessLogic.BusinessLogic.ReceiverModel.FirstName;
            LastName = BusinessLogic.BusinessLogic.ReceiverModel.LastName;
            Number = BusinessLogic.BusinessLogic.ReceiverModel.Number;
            PostCode = BusinessLogic.BusinessLogic.ReceiverModel.PostCode;
            Street = BusinessLogic.BusinessLogic.ReceiverModel.Street;
            Town = BusinessLogic.BusinessLogic.ReceiverModel.Town;

        }

        #region Sender data
        /// <summary>
        /// Gets or sets the first name.
        /// </summary>
        /// <value>The first name.</value>
        public String SendFirstName
        {
            get
            {
                return sendVorname;
            }
            set
            {
                if (sendVorname == value) return;
                sendVorname = value;
                RaisePropertyChanged("Send"+Fields.FIRST_NAME);
            }
        }
        /// <summary>
        /// Gets or sets the last name.
        /// </summary>
        /// <value>The last name.</value>
        public String SendLastName
        {
            get
            {
                return sendVnachname;
            }
            set
            {
                if (sendVnachname == value) return;
                sendVnachname = value;
                RaisePropertyChanged("Send" + Fields.LAST_NAME);
            }
        }
        /// <summary>
        /// Gets or sets the street.
        /// </summary>
        /// <value>The street.</value>
        public String SendStreet
        {
            get
            {
                return sendStrasse;
            }
            set
            {
                if (sendStrasse == value) return;
                sendStrasse = value;
                RaisePropertyChanged("Send" + Fields.STREET);
            }
        }
        /// <summary>
        /// Gets or sets the number.
        /// </summary>
        /// <value>The number.</value>
        public String SendNumber
        {
            get
            {
                return sendHausnummer;
            }
            set
            {
                if (sendHausnummer == value) return;
                sendHausnummer = value;
                RaisePropertyChanged("Send" + Fields.NUMBER);
            }
        }
        /// <summary>
        /// Gets or sets the post code.
        /// </summary>
        /// <value>The post code.</value>
        public int SendPostCode
        {
            get
            {
                return sendPlz;
            }
            set
            {
                if (sendPlz == value) return;
                sendPlz = value;
                RaisePropertyChanged("Send" + Fields.POST_CODE);
            }
        }
        /// <summary>
        /// Gets or sets the town.
        /// </summary>
        /// <value>The town.</value>
        public String SendTown
        {
            get
            {
                return sendOrt;
            }
            set
            {
                if (sendOrt == value) return;
                sendOrt = value;
                RaisePropertyChanged("Send" + Fields.TOWN);
            }
        }
        #endregion

        #region Receiver data
        /// <summary>
        /// Gets or sets the first name.
        /// </summary>
        /// <value>The first name.</value>
        public String FirstName
        {
            get
            {
                return vorname;
            }
            set
            {
                if (vorname == value) return;
                vorname = value;
                RaisePropertyChanged(Fields.FIRST_NAME);
            }
        }
        /// <summary>
        /// Gets or sets the last name.
        /// </summary>
        /// <value>The last name.</value>
        public String LastName
        {
            get
            {
                return nachname;
            }
            set
            {
                if (nachname == value) return;
                nachname = value;
                RaisePropertyChanged(Fields.LAST_NAME);
            }
        }
        /// <summary>
        /// Gets or sets the street.
        /// </summary>
        /// <value>The street.</value>
        public String Street
        {
            get
            {
                return strasse;
            }
            set
            {
                if (strasse == value) return;
                strasse = value;
                RaisePropertyChanged(Fields.STREET);
            }
        }
        /// <summary>
        /// Gets or sets the number.
        /// </summary>
        /// <value>The number.</value>
        public String Number
        {
            get
            {
                return hausnummer;
            }
            set
            {
                if (hausnummer == value) return;
                hausnummer = value;
                RaisePropertyChanged(Fields.NUMBER);
            }
        }
        /// <summary>
        /// Gets or sets the post code.
        /// </summary>
        /// <value>The post code.</value>
        public int PostCode
        {
            get
            {
                return plz;
            }
            set
            {
                if (plz == value) return;
                plz = value;
                RaisePropertyChanged(Fields.POST_CODE);
            }
        }
        /// <summary>
        /// Gets or sets the town.
        /// </summary>
        /// <value>The town.</value>
        public String Town
        {
            get
            {
                return ort;
            }
            set
            {
                if (ort == value) return;
                ort = value;
                RaisePropertyChanged(Fields.TOWN);
            }
        }
        #endregion


        /// <summary>
        /// Gets or sets a value indicating whether this instance has an error.
        /// </summary>
        /// <value><c>true</c> if this instance has an error; otherwise, <c>false</c>.</value>
        public Boolean HasError
        {
            get { return hasError; }
            set { hasError = value; }
        }


        private String sendVorname;
        private String sendVnachname;
        private String sendOrt;
        private String sendStrasse;
        private int sendPlz;
        private String sendHausnummer;

        private String vorname;
        private String nachname;
        private String ort;
        private String strasse;
        private int plz;
        private String hausnummer;
        
        private Boolean hasError;

    }
}
